package site.lanmushan.framework.authorization.config;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import site.lanmushan.framework.authorization.SignFilterManager;
import site.lanmushan.framework.authorization.config.properties.SecurityProperties;

/**
 * @author Administrator
 */
@Configuration
@ConditionalOnProperty(value = "slash.security.enable", havingValue = "true", matchIfMissing = false)
@Slf4j
public class SignFilterManagerConfig {
    @Autowired
    SecurityProperties securityProperties;

    @Bean
    public SignFilterManager signFilterManager() {
        log.info("静态文件权限列表加载{}", JSON.toJSONString(securityProperties.getAllows()));
        return new SignFilterManager(securityProperties.getAllows());
    }
}
